---
title: Can't load the middleware.
i18nReady: true
githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts
---

> **MiddlewareCantBeLoaded**: An unknown error was thrown while loading your middleware.

## 무엇이 잘못되었나요?

미들웨어를 로드하려고 시도하는 동안 오류가 발생하면 개발 모드에서 예외가 발생합니다.

예시:
```ts
import {defineMiddleware} from "astro:middleware";
throw new Error("Error thrown while loading the middleware.")
export const onRequest = defineMiddleware(() => {
  return "string"
});
```